package com.youku.plugins.commonui.view
{
   import flash.display.Sprite;
   import com.youku.baseUI.BaseUILoader;
   import com.youku.utils.DrawUtil;
   import flash.events.MouseEvent;
   import flash.events.Event;
   import com.youku.plugins.commonui.CommonUIEvent;
   
   public class ReadyToPlayScreenV4 extends Sprite
   {
      
      public function ReadyToPlayScreenV4() {
         super();
         this.init();
      }
      
      private var _background:Sprite;
      
      private var _image:BaseUILoader;
      
      private var _width:Number;
      
      private var _height:Number;
      
      private function init() : void {
         this._width = 100;
         this._height = 100;
         this._background = DrawUtil.RectangleSprite(0,0,100,100,0,1,null,0);
         this._background.useHandCursor = true;
         this._background.buttonMode = true;
         this._image = new BaseUILoader();
         this._image.maintainAspectRatio = true;
         this._image.scaleContent = true;
         this._image.useBitmap = true;
         this._image.useHandCursor = true;
         this._image.buttonMode = true;
         this._image.showBackground = false;
         this._image.showBorder = false;
         this._image.setSize(this._width,this._height);
         addChild(this._background);
         addChild(this._image);
         this._background.addEventListener(MouseEvent.CLICK,this.onClick);
         this._image.addEventListener(MouseEvent.CLICK,this.onClick);
      }
      
      private function onClick(param1:Event) : void {
         dispatchEvent(new CommonUIEvent(CommonUIEvent.READY_TO_PLAY_CLICK));
      }
      
      public function show(param1:Boolean) : void {
      }
      
      public function setURL(param1:String) : void {
         if(param1 == null || param1 == "")
         {
            return;
         }
         this._image.source = param1;
      }
      
      public function setSize(param1:Number, param2:Number) : void {
         this._width = param1;
         this._height = param2;
         this._background.width = this._width;
         this._background.height = this._height;
         this._image.setSize(this._width,this._height);
         this._background.x = this._background.y = 0;
         this._image.x = this._image.y = 0;
      }
   }
}
